using System;
using System.Data;
using Utils;
using Utils.DatabaseUtils;


namespace BDS
{
public class BannerUI
{ 
	private int bannerID;
	public int BannerID
	{
		get { return bannerID;}
		set { bannerID = value;}
	}

	private String bannerName;
	public String BannerName
	{
		get { return bannerName;}
		set { bannerName = value;}
	}

	private String bannerImage;
	public String BannerImage
	{
		get { return bannerImage;}
		set { bannerImage = value;}
	}

	private String bannerLink;
	public String BannerLink
	{
		get { return bannerLink;}
		set { bannerLink = value;}
	}

	private int userID;
	public int UserID
	{
		get { return userID;}
		set { userID = value;}
	}

	private int categoryPageID;
	public int CategoryPageID
	{
		get { return categoryPageID;}
		set { categoryPageID = value;}
	}

	private DateTime createDate;
	public DateTime CreateDate
	{
		get { return createDate;}
		set { createDate = value;}
	}

	private bool isEnable;
	public bool IsEnable
	{
		get { return isEnable;}
		set { isEnable = value;}
	}

	public BannerUI() {}

	public BannerUI(int bannerID, String bannerName, String bannerImage, String bannerLink, int userID, int categoryPageID, DateTime createDate, bool isEnable)
	 {
		this.bannerID = bannerID;
 		this.bannerName = bannerName;
 		this.bannerImage = bannerImage;
 		this.bannerLink = bannerLink;
 		this.userID = userID;
 		this.categoryPageID = categoryPageID;
 		this.createDate = createDate;
 		this.isEnable = isEnable;
 	}

	public int Add(String bannerName, String bannerImage, String bannerLink, int userID, int categoryPageID)
	{
		try
		{
            int result = SqlHelper.ExecuteNonQuery(Common.Conn, "Banner_sp", bannerName, bannerImage, bannerLink, userID, categoryPageID);
			return result;
		}
		catch(Exception e) {return -1; }
	}

    public int AddByName(String bannerName, String bannerImage, String bannerLink, string username, int categoryPageID, DateTime createDate, bool isEnable)
    {
        try
        {
            int result = SqlHelper.ExecuteNonQuery(Common.Conn, "Banner_AddByName", bannerName, bannerImage, bannerLink, username, categoryPageID, createDate, isEnable);
            return result;
        }
        catch (Exception e) { return -1; }
    }

	public int Update(int bannerID, String bannerName, String bannerImage, String bannerLink, int userID, int categoryPageID, DateTime createDate, bool isEnable)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"Banner_Update",bannerID,bannerName,bannerImage,bannerLink,userID,categoryPageID,createDate,isEnable);
			return result;
		}
		catch(Exception e) {return -1; }
	}

    public int UpdateByName(int bannerID, String bannerName, String bannerImage, String bannerLink, string userName, int categoryPageID, DateTime createDate, bool isEnable)
    {
        try
        {
            int result = SqlHelper.ExecuteNonQuery(Common.Conn, "Banner_UpdateByName", bannerID, bannerName, bannerImage, bannerLink, userName, categoryPageID, createDate, isEnable);
            return result;
        }
        catch (Exception e) { return -1; }
    }

	public int Delete(int bannerID)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"Banner_Delete",bannerID);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int DeleteAll()
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"Banner_DeleteAll");
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public DataSet Get(int bannerID)
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"Banner_Get",bannerID);
			return result;
		}
		catch(Exception e) {return null; }
	}

	public DataSet GetAll()
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"Banner_GetAll");
			return result;
		}
		catch(Exception e) {return null; }
	}

	public DataSet GetByUserID(int userID)
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"Banner_GetByUserID",userID);
			return result;
		}
		catch(Exception e) {return null; }
	}

	public DataSet GetByCategoryPageID(int categoryPageID)
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"Banner_GetByCategoryPageID",categoryPageID);
			return result;
		}
		catch(Exception e) {return null; }
	}

} 
}
